package com.ricky.onlineShop.shop.trading.enums;

import com.ricky.base.enums.NationalityEnum;
import com.ricky.base.enums.ResultEnum;

/**
 * @Author staticlan
 * @Date 2024/7/24 15:06
 * @Description: 网店信誉等级图片枚举
 */
public enum ReputationLevelEnum {
    ONEHEART("1","一心.png"),
    TWOHEART("2","二心.png"),
    THREEHEART("3","三心.png"),
    FOURHEART("4","四心.png"),
    FIVEHEART("5","五心.png"),
    ONEDIAMOND("6","一钻.png"),
    TWODIAMOND("7","二钻.png"),
    THREEDIAMOND("8","三钻.png"),
    FOURDIAMOND("9","四钻.png"),
    FIVEDIAMOND("10","五钻.png"),
    ONECROWN("11","一皇冠.png"),
    TWOCROWN("12","二皇冠.png"),
    THREECROWN("13","三皇冠.png"),
    FOURCROWN("14","四皇冠.png"),
    FIVECROWN("15","五皇冠.png"),
    ONEGOLDCROWN("16","一金冠.png"),
    TWOGOLDCROWN("17","二金冠.png"),
    THREEGOLDCROWN("18","三金冠.png"),
    FOURGOLDCROWN("19","四金冠.png"),
    FIVEGOLDCROWN("20","五金冠.png"),
    TIANMAO("21","天猫.png"),
    JINGDONG("22","京东.png");


    private String code;
    private String desc;
    ReputationLevelEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static String getCodeByDesc(String desc) {
        ReputationLevelEnum[] reputationLevelEnums = values();
        for (int i = 0; i < reputationLevelEnums.length; i++) {
            ReputationLevelEnum nationalityEnum = reputationLevelEnums[i];
            if (nationalityEnum.getDesc().contains(desc)) {
                return nationalityEnum.getCode();
            }
        }
        return null;
    }

    public static ReputationLevelEnum getByKey(String key) {
        ReputationLevelEnum[] reputationLevelEnums = ReputationLevelEnum.values();
        for (ReputationLevelEnum nationalityEnum : reputationLevelEnums) {
            if (key.equals(nationalityEnum.getCode())) {
                return nationalityEnum;
            }
        }
        return null;
    }

    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
